using System;
using System.Collections.Generic;
using System.Text;
using ECommerce.DAL;
using System.Data.SqlClient;
using System.Data;

namespace Entity
{
    [System.ComponentModel.DataObject]
    public class TblProductPurchaseOrderItemsExtended : TblProductPurchaseOrderItems
    {
        public static CustomCollection<TblProductPurchaseOrderItems> GetOrderItemsByOrderId(int orderId)
        {
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@orderId", SqlDbType.Int, 0, ParameterDirection.Input, orderId);
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBL_PRODUCT_PURCHASE_ORDER_ITEMS_GET_ORDER_ITEMS_BY_ORDER_ID);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblProductPurchaseOrderItemsCollectionFromReader);
            CustomCollection<TblProductPurchaseOrderItems> objCollection = ((CustomCollection<TblProductPurchaseOrderItems>)ExecuteReaderCmd(sqlCmd, test));
            return objCollection;
        }

        public static CustomCollection<TblProductPurchaseOrderItems> GetActiveProductOrderItemsByOrderId(int orderId)
        {
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@orderId", SqlDbType.Int, 0, ParameterDirection.Input, orderId);
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBL_PRODUCT_PURCHASE_ORDER_ITEMS_GET_ORDER_ITEMS_ACTIVE_PRODUCT_BY_ORDER_ID);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblProductPurchaseOrderItemsCollectionFromReader);
            CustomCollection<TblProductPurchaseOrderItems> objCollection = ((CustomCollection<TblProductPurchaseOrderItems>)ExecuteReaderCmd(sqlCmd, test));
            return objCollection;
        }


        private const string SP_TBL_PRODUCT_PURCHASE_ORDER_ITEMS_GET_ORDER_ITEMS_BY_ORDER_ID = "sp_TblProductPurchaseOrderItems_GetOrderItemsByOrderId";
        private const string SP_TBL_PRODUCT_PURCHASE_ORDER_ITEMS_GET_ORDER_ITEMS_ACTIVE_PRODUCT_BY_ORDER_ID = "sp_TblProductPurchaseOrderItems_GetOrderItems_Active_Products_ByOrderId";
    }
}
